package cn.anecansaitin.industrialization_expansion.api.common.event;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.world.World;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraftforge.eventbus.api.Event;

/**
 * 自定义工具被使用时触发
 */
public class ToolUseEvent extends Event {
    private final Hand hand;
    private final World world;
    private final PlayerEntity player;
    private ActionResult<ItemStack> result;

    public ToolUseEvent(World world, PlayerEntity player, Hand hand) {
        this.world = world;
        this.player = player;
        this.hand = hand;
        result = ActionResult.pass(player.getItemInHand(hand));
    }

    public Hand getHand() {
        return hand;
    }

    public World getWorld() {
        return world;
    }

    public PlayerEntity getPlayer() {
        return player;
    }

    public void setUseResult(ActionResult<ItemStack> result) {
        this.result = result;
    }

    public ActionResult<ItemStack> getUseResult() {
        return result;
    }
}
